package com.yiyuan.user.controller;

import com.yiyuan.common.result.Result;
import com.yiyuan.user.base.result.Results;
import com.yiyuan.user.model.Dict;
import com.yiyuan.user.service.DictService;
import io.swagger.annotations.Api;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;
import java.util.List;
import java.util.Map;


/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author kappy
 * @since 2021-05-26
 */
@Api(tags = {""})
@RestController
@RequestMapping("/dict")
public class DictController {
    @Autowired
    private DictService dictService;

    private Logger log = LoggerFactory.getLogger(getClass());

    @RequestMapping("/findDiceByParentId/{parentId}")
    public Result findById(@PathVariable(required = false) Integer parentId){
        List<Dict> qjlbList = dictService.findDiceByParentId(parentId);
        List<Dict> ksList = dictService.findDiceByParentId(4000);
        Map<String,List<Dict>> map=new HashMap<>();
        map.put("qjlbList",qjlbList);
        map.put("ksList",ksList);
        return Result.ok(map);
    }
}
